using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._AnalysisTools._Statistics
{
    /// <summary>
    /// <para>Frequency</para>
    /// <para>Reads a table and a set of fields and creates a new table containing unique field values and the number of occurrences of each unique field value.</para>
    /// <para>读取一个表和一组字段，并创建一个新表，其中包含唯一字段值和每个唯一字段值的出现次数。</para>
    /// </summary>    
    [DisplayName("Frequency")]
    public class Frequency : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public Frequency()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_table">
        /// <para>Input Table</para>
        /// <para>The table containing the field(s) that will be used to calculate frequency statistics.</para>
        /// <para>包含将用于计算频率统计信息的字段的表。</para>
        /// </param>
        /// <param name="_out_table">
        /// <para>Output Table</para>
        /// <para>The output table that will store the frequency statistics.</para>
        /// <para>将存储频率统计信息的输出表。</para>
        /// </param>
        /// <param name="_frequency_fields">
        /// <para>Frequency Field(s)</para>
        /// <para>The field(s) used to calculate frequency statistics. Each unique combination of field values will be included as a new row in the output table.</para>
        /// <para>用于计算频率统计信息的字段。字段值的每个唯一组合将作为新行包含在输出表中。</para>
        /// </param>
        public Frequency(object _in_table, object _out_table, List<object> _frequency_fields)
        {
            this._in_table = _in_table;
            this._out_table = _out_table;
            this._frequency_fields = _frequency_fields;
        }
        public override string ToolboxName => "Analysis Tools";

        public override string ToolName => "Frequency";

        public override string CallName => "analysis.Frequency";

        public override List<string> AcceptEnvironments => ["configKeyword", "scratchWorkspace", "workspace"];

        public override object[] ParameterInfo => [_in_table, _out_table, _frequency_fields, _summary_fields];

        /// <summary>
        /// <para>Input Table</para>
        /// <para>The table containing the field(s) that will be used to calculate frequency statistics.</para>
        /// <para>包含将用于计算频率统计信息的字段的表。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_table { get; set; }


        /// <summary>
        /// <para>Output Table</para>
        /// <para>The output table that will store the frequency statistics.</para>
        /// <para>将存储频率统计信息的输出表。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_table { get; set; }


        /// <summary>
        /// <para>Frequency Field(s)</para>
        /// <para>The field(s) used to calculate frequency statistics. Each unique combination of field values will be included as a new row in the output table.</para>
        /// <para>用于计算频率统计信息的字段。字段值的每个唯一组合将作为新行包含在输出表中。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Frequency Field(s)")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public List<object> _frequency_fields { get; set; }


        /// <summary>
        /// <para>Summary Field(s)</para>
        /// <para>The attribute field(s) to sum and add to the output table. Values will be summed for each unique combination of frequency fields. Null values are excluded from this calculation.</para>
        /// <para>要求和并添加到输出表的属性字段。将对每个唯一频率场组合的值求和。此计算中不包括 Null 值。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Summary Field(s)")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public List<object> _summary_fields { get; set; } = null;


        public Frequency SetEnv(object configKeyword = null, object scratchWorkspace = null, object workspace = null)
        {
            base.SetEnv(configKeyword: configKeyword, scratchWorkspace: scratchWorkspace, workspace: workspace);
            return this;
        }

    }

}